<!DOCTYPE html>
<html lang="zh-Hans-CN">
<head>
    <meta charset="UTF-8">
    <title>内置指令:v-on:事件名="方法名"</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="../vue.js"></script>
</head>
<body>
<h2>【例14】内置指令:v-on:事件名="方法名"/简写 @事件名="方法名"</h2>
<hr>
<div id="app">
    <p>{{msg}}</p>
    <p v-text="msg"></p>
    <button v-on:click="showInfo">请单击</button>
    <button @click="showInfo">请单击(简写)</button>
</div>
<script>
    let vm = new Vue({
        el: '#app',
        data: {msg: '请单击按钮查看内容'},
        methods: {
            showInfo() {
                this.msg = '我是v-on指令'
            }
        }
    })
</script>
<hr>
<p><a href="index.html">返回章节目录</a>
    <script>document.write(document.lastModified); </script>
</p>
</body>
</html>
